package cn.zqh.auth.controller;


import cn.zqh.auth.pojo.Router;
import cn.zqh.auth.service.RouterService;
import cn.zqh.bean.api.CommonResult;
import cn.zqh.bean.bo.AddANewRouter;
import cn.zqh.bean.bo.AdminChangeRouter;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zqh
 * @since 2022-12-22
 */
@Api("路由管理")
@RestController
@RequestMapping("/router")
public class RouterController {

    @Autowired
    private RouterService routerService;


    /**
      * @Author: zqh
      * @Date:
      * @Description: 添加一个新路由
    */
    @ApiOperation(value = "添加一个新路由")
    @PostMapping("addANewRouter")
    public CommonResult addANewRouterInfo(@RequestBody AddANewRouter addANewRouter){
        return routerService.addANewRouterInfo(addANewRouter);
    }

    /**
      * @Author: zqh
      * @Date:
      * @Description: 修改某个路由的信息
    */
    @ApiOperation(value = "修改某个路由的信息")
    @PostMapping("modifyARouteInformation")
    public CommonResult modifyARouteInformation(@RequestBody AdminChangeRouter adminRouter){
        return routerService.modifyARouteInformation(adminRouter);
    }

    /**
      * @Author: zqh
      * @Date:
      * @Description: 查询路由
    */
    @ApiOperation(value = "通过id查询路由")
    @GetMapping("getRouterById")
    public CommonResult getRouterById(Integer routeId){
        return routerService.getRouterById(routeId);
    }

    /**
      * @Author: zqh
      * @Date:
      * @Description: 查询所有路由
    */
//    @ApiOperation(value = "查询所有路由")
//    @GetMapping("getAllRouter")
//    public CommonResult getAllRouter(){
//        return routerService.getAllRouter();
//    }




}

